﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Mechanics.GameEventMechanics {
    import flash.display.*;
    import Mechanics.GameMechanicInterfaces.*;
    import Mechanics.*;
    import Events.*;
    import flash.utils.*;
    import Classes.util.*;

    public class FriendRewardsDialogMechanic extends DialogGenerationMechanic implements IDialogGenerationMechanic, IMultiPickSupporter {

        override public function canPopDialog():Boolean{
            var _local1:Object = super.getDataForDialog();
            if (((_local1) && ((GameUtil.countObjectLength(_local1) > 0)))){
                return (super.canPopDialog());
            };
            return (false);
        }
        override public function instantiateDialog():DisplayObject{
            var _local3:DisplayObject;
            var _local1:Class = (getDefinitionByName(m_config.params["dialogToPop"]) as Class);
            var _local2:String = m_config.params["localeKey"];
            if (_local2 == null){
                throw (new Error((("localeKey attribute not specified for " + m_config.params["dialogToPop"]) + "!")));
            };
            var _local4:Object = getDataForDialog();
            if (_local4){
                _local3 = new _local1(m_owner, _local2, _local4, this.dialogCloseCallback);
            };
            return (_local3);
        }
        protected function dialogCloseCallback(_arg1:GenericPopupEvent):void{
            var _local2:String = m_config.params["dataSourceType"];
            var _local3:IDictionaryDataMechanic = (MechanicManager.getInstance().getMechanicInstance(m_owner, _local2, MechanicManager.ALL) as IDictionaryDataMechanic);
            if (_local3){
                _local3.clear();
            };
        }
        public function getPick():String{
            return (m_config.params["pick"]);
        }

    }
}//package Mechanics.GameEventMechanics 
